<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>直播间详情</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/favicon.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <!--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.2/css/swiper.css">-->
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm.css">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm-extend.css">
</head>
<body>
<div class="page">
    <div class="content" data-type="">
        <div class="tabs">
            <div id="tab3"  class="tab active infinite-scroll">
                <div class="list-block">
                    <ul class="list-container">
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                        <li class="item-content"><div class="item-inner"><div class="item-title">条目</div></div></li>
                    </ul>
                </div>
                <!-- 加载提示符 -->
                <div class="infinite-scroll-preloader">
                    <div class="preloader">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="https://cdn.bootcss.com/zepto/1.2.0/zepto.js"></script>
<script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
<script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm-extend.js' charset='utf-8'></script>
<script src="//qzonestyle.gtimg.cn/open/qcloud/video/live/h5/live_connect.js" charset="utf-8"></script>
<script src="https://cdn.ronghub.com/RongIMLib-2.2.7.min.js"></script>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
<script src="https://cdn.ronghub.com/RongEmoji-2.2.5.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script>
    $(document).ready(function () {
        //解决jquery和zepto冲突
        var $$=$.noConflict();
        $(document).on("pageInit",  function(e, id, page) {
            //多个标签页下的无限滚动
            var loading = false;
            // 每次加载添加多少条目
            var itemsPerLoad = 20;
            // 最多可加载的条目
            var maxItems = 100;
            var lastIndex = $('.list-container li')[0].length;
            function addItems(number, lastIndex) {
                // 生成新条目的HTML
                var html = '';
                for (var i = lastIndex + 1; i <= lastIndex + number; i++) {
                    html += '<li class="item-content" onClick="alert(1)"><div class="item-inner"><div class="item-title">新条目</div></div></li>';
                }
                // 添加新条目
                $('.infinite-scroll.active .list-container').append(html);
            }
            $(page).on('infinite', function() {
                alert("刷新")
                // 如果正在加载，则退出
                if (loading) return;
                // 设置flag
                loading = true;
                var tabIndex = 0;
                if($(this).find('.infinite-scroll.active').attr('id') == "tab2"){
                    tabIndex = 0;
                }
                if($(this).find('.infinite-scroll.active').attr('id') == "tab3"){
                    tabIndex = 1;
                }
                lastIndex = $('.list-container').eq(tabIndex).find('li').length;
                // 模拟1s的加载过程
                setTimeout(function() {
                    // 重置加载flag
                    loading = false;
                    if (lastIndex >= maxItems) {
                        // 加载完毕，则注销无限加载事件，以防不必要的加载
                        //$.detachInfiniteScroll($('.infinite-scroll').eq(tabIndex));
                        // 删除加载提示符
                        $('.infinite-scroll-preloader').eq(tabIndex).hide();
                        return;
                    }
                    addItems(itemsPerLoad,lastIndex);
                    // 更新最后加载的序号
                    lastIndex =  $('.list-container').eq(tabIndex).find('li').length;
                    $.refreshScroller();
                }, 1000);
            });
        });
        $.init();
    })
</script>
</body>
</html>